package com.br.sae.controls;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.br.sae.model.dao.DisciplinaBD;
import com.br.sae.model.entitys.Disciplina;

public class LogicaFormDisciplinas implements Logica{

	@Override
	public String executa(HttpServletRequest req, HttpServletResponse res)
			throws Exception {
		List<Disciplina> disciplinas = consultaDisciplina();
		System.out.println("Disciplinas: "+disciplinas.size());
		req.setAttribute("disciplinas", disciplinas);
			
		return "mostra_disciplina.jsp";
	}

	private List<Disciplina> consultaDisciplina(){
		DisciplinaBD disciplinaBD = new DisciplinaBD();
		List<Disciplina> disciplinas = disciplinaBD.consultaDisciplina();
		return disciplinas;
	}

}
